package feeinterface.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ulwx.tool.DbUtils;

import feeinterface.modeldb.BaseClientSmsClose;
import feeinterface.protocol.utils.Constants;

public class BaseClientSmsCloseDao {

	public static BaseClientSmsClose getClientSmsCloseInfoBy(int ProvinceID,
			String phoneFactoryJc) throws Exception {
		
		String sql = "SELECT * 	FROM BaseClientSmsClose WHERE "
				+ "(CloseConditionType = ?  and CloseCondition=?) or"
				+ "(CloseConditionType = ?  and CloseCondition=?) or"
				+ "(CloseConditionType = ?  and CloseCondition=?)"
				+ " order by CloseConditionType desc limit 1";
		Map<Integer, Object> args = new HashMap<Integer, Object>();
		args.put(1, Constants.BaseClientSmsCloseType.TDefault);
		args.put(2, Constants.BaseClientSmsCloseType.DefaultName);
		args.put(3, Constants.BaseClientSmsCloseType.TPhoneFacotry);
		args.put(4, phoneFactoryJc);
		args.put(5, Constants.BaseClientSmsCloseType.TProvince);
		args.put(6, ProvinceID);

		List<BaseClientSmsClose> list = DbUtils.doQueryClass(null,
				BaseClientSmsClose.class, sql, args);
		if(list.size()>0) return list.get(0);
		return null;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
